package com.small.view;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.small.R;

public class Home_listAda extends BaseAdapter{

	List<String> list; 
	LayoutInflater li;
	public Home_listAda(Context co){
		this.li=LayoutInflater.from(co);
		list = new ArrayList<String>();
		list.add("电子凭证֤");
		list.add("优惠信息");
		list.add("商家新鲜事");
		list.add("个人中心");
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		convertView=null;
		convertView=li.inflate(R.layout.home_list_item, null);
		ImageView img=(ImageView)convertView.findViewById(R.id.item_img);
		TextView txt_name=(TextView)convertView.findViewById(R.id.item_name);
		TextView txt_detail=(TextView)convertView.findViewById(R.id.item_detail);
		switch (position) {
		case 0: 
			img.setImageResource(R.drawable.home_btn_ec);
			txt_name.setText(list.get(position));
			txt_detail.setText("到店消费时,出示或者相应验证后即可享受签约商户所提供的打折优惠。");
			break;
		case 1:
			img.setImageResource(R.drawable.home_btn_pi);
			txt_name.setText(list.get(position));
			txt_detail.setText("掌握最新、最近、最热门的优惠信息活动和新款产品。");
			break;
		case 2:
			img.setImageResource(R.drawable.home_btn_news);
			txt_name.setText(list.get(position));
			txt_detail.setText("让您第一时间了解您所关注的商家的最新动态。");
			break;
		case 3:
			img.setImageResource(R.drawable.home_btn_user);
			txt_name.setText(list.get(position));
			txt_detail.setText("我的小九九本地生活。");
			break;
		}
		
		return convertView;
	}

}
